local chuanfo = fk.CreateSkill {
  name = "lingling__chuanfo",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lingling__chuanfo"] = "传佛",
  [":lingling__chuanfo"] = "锁定技，结束阶段，若你有【桃】，你须交给一名其他角色一张【桃】。",

  ["#lingling__chuanfo-choose"] = "传佛：你须交给一名其他角色一张【桃】",
}

chuanfo:addEffect(fk.EventPhaseStart, {
  anim_type = "negative",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(chuanfo.name) and player.phase == Player.Finish and
      #player.room:getOtherPlayers(player, false) > 0 and
      table.find(player:getCardIds("h"), function(id)
        return Fk:getCardById(id).trueName == "peach"
      end)
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local to, card = room:askToChooseCardsAndPlayers(player, {
      min_card_num = 1,
      max_card_num = 1,
      min_num = 1,
      max_num = 1,
      targets = room:getOtherPlayers(player, false),
      pattern = "peach",
      skill_name = chuanfo.name,
      prompt = "#lingling__chuanfo-choose",
      cancelable = false,
    })
    room:moveCardTo(card, Card.PlayerHand, to[1], fk.ReasonGive, chuanfo.name, nil, true, player)
  end,
})

return chuanfo
